import QtQuick 2.0

Item {
    id: root
    property alias text: txt.text
    property int speed: 300
    property alias color: txt.color
    property bool started: false
    visible: false

    function start()
    {
        anim.running = true
        root.visible = true
        started = true
    }

    function stop()
    {
        anim.running = false
        root.visible = false
        started = false
    }

    Text {
        id: txt
        y: 0
        height: root.height
        color: "white"
        font.pointSize: 58

        NumberAnimation on x {
            id: anim
            running: false
            loops: Animation.Infinite
            from: root.x + root.width
            //easing.type: Easing.Linear
            to: -txt.width
            duration: txt.width * root.speed
        }
    }
}
